<template>
  <div class="content">
    <el-dialog :visible.sync="isShow" width="1200px">
      <el-tabs tab-position="left" style="height: 600px;" v-model="currentTab" @tab-click="tabClick">
        <el-tab-pane label="文章" name="selectArticle">
          <selectArticle ref="selectArticle"></selectArticle>
        </el-tab-pane>
      </el-tabs>
      <div style="margin-left: 100px;margin-top: 20px;">
        <el-button type="primary" @click="confirm">确定</el-button>
        <el-button type="info" @click="close">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Editor from '@/components/Editor'
import selectArticle from '../selectArticle/index.vue'
import {tools} from '@/utils/tools.js'
export default {
  components: {Editor, selectArticle},
  props:{
    
  },
  data() {
      return {
        richtext: '',
        isShow: false,
        currentTab: 'selectArticle',
      }
  },
  created(){

  },
  methods: {
    show(){
      this.isShow = true
    },
    close(){
      this.isShow = false
    },
    tabClick(e){
      this.currentTab = e.name
      switch (this.currentTab) {
        case 'item':
          // this.$refs.selectItem.formKey = 'filterItem'
          // this.$refs.selectItem.getFormData()
          break;
        case 'itemList':
          // this.$refs.selectItemList.formKey = 'filterItem'
          // this.$refs.selectItemList.getFormData()
          break;
        default:
          break;
      }
    },
    confirm(){
      var query = {}
      switch (this.currentTab) {
        case 'selectArticle':
          if(!this.$refs.selectArticle.itemFilter){
            this.$message.error('请选择筛选条件');
            return
          }
          query.url = 'system/articleForP/'
          query.requestMethod = 'get'
          query.routeName = 'articleDetail'
          query.modal = 'push'
          query = Object.assign(query, tools.paramsToObj(this.$refs.selectArticle.itemFilter))
          break;
          
        default:
          break;
      }
      this.$emit('handleSelect', JSON.stringify(query))
      this.isShow = false
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
